# -*- coding: utf-8 -*-
import sys, os, re, traceback

if __name__ == '__main__':
    try:
        client  = paramiko.SSHClient()
        client.load_system_host_keys()
        client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
        client.connect('mana.vn', 22, 'daudm', '1p%^IRg')
        stdin, stdout, stderr   = client.exec_command('ls')
        for line in stdout:
            print '...' + line.strip('\n')
        client.close()
        '''
        localfile   = '/allfile/data/programming/crawler/src/xkcn.info.py'
        remotehost  = 'daudm@mana.vn'
        remotefile  = '/home/daudm/a/b/c/d'
        
        os.system('ssh %s "mkdir -p %s; chmod -R 777 a"' % (remotehost, remotefile))
        os.system('scp "%s" "%s:%s"' % (localfile, remotehost, remotefile))
        '''
    except:
        traceback.print_exc()
